<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of Lib_Component
 *
 * @author Zelic
 */
class Lib_Component {
    var $name;
    var $model;
    var $view;
    var $data;
    var $module;

    /**
     * Component name convention:
     * App_<Module>_Component_<ComponentName>;
     */
    function __construct($model, $module) {
        $modelName = 'App_Public_Model_'.$model;
        $part = explode('_', get_class($this));
        $this->name = $part[3];
        $this->model = new $modelName;
        $this->view = new Lib_View();
        $this->module = $module;
    }

    function action() {
        
    }

    function render() {
        $this->action();
        if (is_null($this->view)) {
            echo "No view for this action!";
        }
        return $this->view->renderComponent($this->name, $this->module, $this->data);
    }

}

?>
